{% extends "layouts/baseview-nav.html" %}
{% load i18n %}
{% load short_uri %}

{%block title%}searchresult{%endblock%}

{% block extrascript %}
<link rel="stylesheet" href="/css/new_open.css" />
<script type="text/javascript">
function watch_project(o,projname) {
q_get('prj/watch/' + projname, {}, function(r){
$(o).text(r[0]);
$('#watch_text').text(r[1]);
});
}
</script>
{% endblock %}

{%block main-nav%}

{% endblock %}



{%block body-menu%}
<!--
<div class="pagination">
      {%for m in bodymenus%}
	   <a class="pg-page pg-item" href="{{m.uri}}" data-page="{{m.text}}" > {{m.text}} </a>
      {%endfor%}
</div>
-->
{%endblock%}


{%block main-block%}
<div class="d-g-wrapper d-p-code">
	
	{%if ptype == 'error'%}
		<h2 class="d-p-project-name"><a href="/project/explore" > {% trans "main" %}</a>
		<span>&nbsp;&nbsp;>&nbsp;&nbsp;</span>{% trans "Please pick something,to search"%}</h2>

	{%endif%}	
	
	{%if ptype == 'nothing'%}
	<div class = "no-result" >什么都搜不到 </div>
	{%endif%}
	
	
	{%if ptype == 'User'%}
		<h2 class="d-p-project-name"><a href="/project/explore" > {% trans "main" %}</a>
		<span>&nbsp;&nbsp;>&nbsp;&nbsp;</span>{% trans "search have"%}“{{key}}”{% trans "people，have"%}{{account}}{% trans "ge"%}</h2>
		
		<ul class="d-p-searchuserlist layout">
			{% for user in page.object_list%}
		        <li>
		             <a  href="/u/{{user.name}}/">
		                <div class="user-photo">{%gravatar user.email user.name 105 %}</div>
		                <span class="d-g-orange">{{user.name|truncatechars:15}}</span>
		            </a>
		        </li>
		        
			{% endfor %} 
	    </ul>
	    {% include "layouts/page-nav.html" %}
	 {%endif%}	
	 
	 
	 {%if ptype == 'Project'%}
			<div class="d-p-project-top">
				<h2 class="d-p-project-name"><a href="/project/explore" > {% trans "main" %}</a>
				<span>&nbsp;&nbsp;>&nbsp;&nbsp;</span>{% trans "search have"%}“{{key}}”{% trans "people，have"%}{{account}}{% trans "ge"%}</h2>
			</div>
			<div class="d-p-newopen">	
				<table>
					{%for project in prjs%}
						<tr>
							{%include "project/prj-info.html" with project=project%}
							
							<td>
							{% if project.owner != user%}
                
			                	{% if project.my_status == 3 or project.my_status == 0 %}
			                	
								<a class="d-p-project-praise p-p-project-btn"  href= "javascript:void(0)" onclick="watch_project(this,'{{project.name}}');">
								{{project.watcher_count|default:0}} 
								
								</a>	
								{% endif %}
								
							{%endif%}
									
							</td>

						</tr>
					{%endfor%}
				</table>
			 {% include "layouts/page-nav.html" %}
			</div>
				 	
	 		
	 	
	 	
	 {%endif%}
	 
	 
	 
</div>
<script>
	KISSY.use('js/app/main/new_open');
</script>
{%endblock%}
